package cn.wolfcode.luowowo.search.query;

import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;

@Getter
@Setter
public class SearchQueryObject extends QueryObject {
    //常量    根据网页传过来的参数
    //搜索所有
    public static  final  int SEARCH_TYPE_ALL = -1;
    //搜索目的地
    public static  final  int SEARCH_TYPE_DEST = 0;
    //搜索攻略
    public static  final  int SEARCH_TYPE_STRATEGY = 1;
    //搜索游记
    public static  final  int SEARCH_TYPE_TRAVEL = 2;
    //搜索用户
    public static  final  int SEARCH_TYPE_USER = 3;
    //搜索问答
    public static  final  int SEARCH_TYPE_WENDA = 4;

    //默认
    private  int type = SEARCH_TYPE_ALL;

    //分页
    public Pageable getPageable(){
        return PageRequest.of(super.getCurrentPage()-1,super.getPageSize());
    }

}
